package org.dynamic.test;

import java.util.Properties;

import org.dynamic.config.Application;
import org.dynamic.model.Person;
import org.dynamic.spring.PersonFactoryBean;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:applicationContext.xml","classpath:beans.xml"})
public class SpringJunit {
	
	@Autowired
	private PersonFactoryBean personFactoryBean;
	
	
	@Scheduled(cron="*/2 * * * * ?")
	@Test
	public void person() throws Exception{
		Person p = personFactoryBean.getObject();
		System.out.println(p);
	}
	@Test
	public void start(){
		System.out.println("ApplicationListener");
		Properties p = Application.getInstance().properties;
		System.out.println(p);
	}
}
